const querystring = require('querystring')

function myBodyParser(req, res, next) {
  let data = ''
  req.on('data', chunk => {
    data += chunk.toString()
  })
  req.on('end', () => {
    req.body = querystring.parse(data)
    next()
  })
}

module.exports = myBodyParser
